package ba.examples.hibernate;

import java.util.Properties;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;


public class HibernateUtility {

	public static SessionFactory getHibernateTestSf() {
		
		AnnotationConfiguration cfg = new AnnotationConfiguration();
		
		Properties prop = new Properties();
		prop.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/demo");
		prop.setProperty("hibernate.connection.username", "demo");
		prop.setProperty("hibernate.connection.password", "demo");
		prop.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
		prop.setProperty("hibernate.current_session_context_class", "thread");
		
		cfg.setProperties(prop);
		
		SessionFactory sf = cfg.buildSessionFactory();
		
		return sf;
	}
	
}
